package 二叉树;

//226 翻转二叉树
public class Solution1 {
    public TreeNode invertTree(TreeNode root) {
        dfs(root);
        return root;
    }
    void dfs(TreeNode root){
        if(root==null){
            return ;
        }
        TreeNode tmp = new TreeNode();
        tmp=root.left;
        root.left = root.right;
        root.right = tmp;
        dfs(root.left);
        dfs(root.right);
    }
}
